﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<z.m.db.Product>" %>

<% if (ViewData["type"] == "header") {%>
	<tr>
		<td><%: Html.LabelFor(m=>m.ID) %></td>
		<td><%: Html.LabelFor(m=>m.Name) %></td>
		<td><%:Html.LabelFor(m=>m.Price)%></td>
		<td><%:Html.LabelFor(m=>m.Detail)%></td>
		<td colspan="99">Controll</td>
	</tr>
<%} else if (ViewData["type"] == null) {%>
<tr id="pr<%:Model.ID%>" data-id="<%:Model.ID%>">
	<td>
		<div class="img">
			<img style="max-width: 100px; max-height: 100px" src="<%:Url.Content("~/Content/img/p/"+Model.ID+".jpg") %>" />
		</div>
		<input name="ID" readonly="true" type="text" value="<%:Model.ID %>" />
	</td>
	<td><%:Html.EditorFor(m=>m.Name)%><%:Html.ValidationMessageFor(m=>m.Name) %></td>
	<td><%:Html.EditorFor(m=>m.Price)%><%:Html.ValidationMessageFor(m=>m.Price) %></td>
	<td>
		<div class="hidden">
			<div class="close" onclick="closePopup(this.parentElement);destroyEditor();"></div>
			<textarea name="Detail"><%:Model.Detail %></textarea>
		</div>
		<input value="Detail" type="button" onclick="showPopup('#pr<%:Model.ID%> div.hidden');installEditor('#pr<%:Model.ID%>');" />
	</td>
	<td>
		<input name="file" type="file" accept="image/jpeg" />
	</td>
	<td>
		<input type="button" value="<%:Model.ID==0?"Add":"Save" %>" onclick='ajaxTrSubmit(event);' />
	</td>
	<td>
		<input type="button" value="Delete" onclick='ajaxTrBtn(event,"Delete");' />
	</td>
</tr>
<%}%>